home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / parallax / routines.doc < prev    next >
Encoding:
Text File  |  1994-09-01  |  22.4 KB  |  779 lines

  1.  
  2. *** NOTE: The following code is only about 50% optimized.
  3.  
  4.  
  5. {..........................................................}
  6. PROCEDURE Draw_Screen_ASM (s_x, s_y, o_x, o_y : word;
  7.                            VAR shp_ptr, bshp_ptr, map, bmap, CT,
  8.                                FANM, BANM; bscroll : byte);
  9. VAR
  10.    x, y               : word;
  11.    draw_x, draw_y     : word;
  12.    shape_offs         : word;
  13.    di_save            : word;
  14.    back_si_save       : word;
  15.    bo_x, bo_y         : word;
  16.    x_to_draw          : word;
  17.    x_to_skip          : word;
  18.    y_to_draw          : word;
  19.    y_skip_offs        : word;
  20.    ct_di_save         : word;
  21.  
  22. BEGIN
  23.  
  24. ASM
  25.      push ds
  26.  
  27.      mov [ct_di_save], 0
  28.  
  29.      les di, [screen]
  30.      mov [di_save], di
  31.  
  32.                         { Now we want to figure out background }
  33.                         { coords and offset of top left shape }
  34.                         { in background. }
  35.                         { This is a transformation of s_x, s_y }
  36.                         { into background coords...}
  37.                         { Once this is found, any other background }
  38.                         { shapes are merely offset from this...}
  39.      mov ax, [s_x]
  40.      mov bx, [s_y]            { Get s_x, s_y * 32 to get world coords }
  41.      shl ax, 5
  42.      shl bx, 5
  43.  
  44.      sub ax, [o_x]            { sub player offset from world coords }
  45.      sub bx, [o_y]
  46.  
  47.      shr ax, 1                { Divide by 2 to get background world }
  48.      shr bx, 1                { world coords...}
  49.      push ax                  { Save coords...}
  50.      push bx
  51.  
  52.      and ax, 31               { Get offset in shape to begin drawing }
  53.      and bx, 31
  54.      mov [bo_x], ax           { Save offsets }
  55.      mov [bo_y], bx
  56.      pop bx                   { Restore background world coords }
  57.      pop ax
  58.  
  59.      shr ax, 5                { Get background map coords of shape }
  60.      shr bx, 5                { = world coords. / 32...}
  61.  
  62.                         { Now, in ax is b_x, in bx is b_y...CONFUSING???}
  63.  
  64.                         { Coords of top left shape in background }
  65.      shl bx, 7                { Multiply ax(b_x) * 128(size of map x) }
  66.      add bx, ax               { Add in x coord to get full offset }
  67.  
  68.      mov [back_si_save], bx   { Save in variable }
  69.  
  70.                         { Now precalculate stuff for drawing background }
  71.                         { x_to_draw   : 32 - bo_x...}
  72.                         { y_skip_offs : bo_y * 32...}
  73.                         { y_to_draw   : 32 - bo_y...}
  74.  
  75.  
  76.      cmp [bscroll], 0            { If non-scrolling background then }
  77.      je @@FIGURE_STUFF           { set background index to set point }
  78.                                  { and make adjustments:             }
  79.      mov [back_si_save], 0
  80.      mov ax, 31                  { Since screen copied adjusted by values }
  81.      mov bx, 31                  { in o_x and o_y, we want to draw }
  82.      sub ax, [o_x]               { 32 - o_x OR o_y of background shape }
  83.      sub bx, [o_y]               { and then start drawing next shape, this }
  84.      mov [bo_x], ax              { will cause next shape to align with }
  85.      mov [bo_y], bx              { copying of screen, and in effect the }
  86.                                  { background will not move!!! }
  87.      cmp [bo_y], 32
  88.      jne @@FIGURE_STUFF
  89.      mov [bo_y], 0
  90.  
  91. @@FIGURE_STUFF:
  92.      mov ax, 32
  93.      sub ax,[bo_x]
  94.      mov [x_to_draw], ax
  95.  
  96.      mov bx, [bo_y]
  97.      shl bx, 5
  98.      mov [y_skip_offs], bx
  99.  
  100.      mov ax, 32
  101.      sub ax, [bo_y]
  102.      mov [y_to_draw], ax
  103.  
  104. @@CONTINUE:
  105.      lds si, [map]
  106.                               { Now get offset of top-left foreground shape.}
  107.      mov ax, [s_y]
  108.      shl ax, 7                { Mult. Y coord by 128, add X coord...}
  109.      add ax, [s_x]
  110.      add si, ax               { Gives offset in Map of first square...}
  111.  
  112.      mov dh, 6                { dh is y counter for loop...}
  113.  
  114. @@LOOP_Y:
  115.      mov dl, 10               { dl is counter for x loop...}
  116.  
  117. @@LOOP_X:
  118.      mov [di_save], di        { Save location in screen of top-left corner }
  119.                               { of current square..}
  120.  
  121.      xor ax, ax
  122.      mov al, [si]             { Get byte from Map... Square #...}
  123.  
  124.      {.................................................}
  125.                          { Now Check to see if Shape animating and if so }
  126.                          { draw the proper animation shape...}
  127.      push ds
  128.      push si
  129.  
  130.      lds si, [FANM]      { Set pointer to Foreground anim data }
  131.      mov bx, ax          { Get shape number in bx }
  132.      shl bx, 4           { Multiply bx by 16 to get proper row of data }
  133.                          {   in Anim array...}
  134.      add si, bx
  135.  
  136.      xor bx, bx
  137.      mov bl, ds:[si]     { Get byte of data from anim array }
  138.      cmp bl, 255         { If CURRENT INDEX equals 255, then draw shape
  139.                          { as normally would...}
  140.      je @@END_ANIM_CHECK
  141.  
  142.      add si, 3           { Move to first byte of anim pictures }
  143.      add si, bx          { Add CURRENT INDEX... }
  144.  
  145.      mov al, ds:[si]     { Get proper shape number to draw...}
  146.  
  147. @@END_ANIM_CHECK:
  148.      pop si
  149.      pop ds
  150.      {.................................................}
  151.  
  152.      cmp al, 0
  153.      jz @@DRAW_BACK           { If Shape is ZERO, then square is }
  154.                               { transparent and we want background }
  155.                               { to show through, so jump to background }
  156.                               { drawing label...}
  157.      cmp al, 30
  158.      jae @@DRAW_BACK          { ALSO, if shape => 32, then shape is either}
  159.                               { transparent and we need to draw }
  160.                               { background THEN foreground...OR shape needs}
  161.                               { to be drawn LAST, after all objects, etc..}
  162.                               { it is a shape which covers everything...}
  163.  
  164.      shl ax, 10               { Mul ax by 1024 to get Offset in Shape buffer.}
  165.                               { of shape we want to draw...}
  166. @@DRAW_FORE:
  167. (*****************************************************)
  168.    push ds
  169.    push si
  170.  
  171.    lds si, [shp_ptr]
  172.    add si, ax                 { ax holds offset in shape buffer }
  173.  
  174.    cld                           { Increment }
  175.    mov bx, 32d
  176.  
  177. @@DRAW:
  178.    mov cx, 16
  179.    rep movsw
  180.  
  181.    add di, 288                   { re-align di to next row }
  182.  
  183.    dec bx                        { Count down one row, check if }
  184.    jnz @@DRAW                    { finished last row...         }
  185.  
  186.    jmp @@END_DRAW
  187. (*****************************************************)
  188.  
  189. @@DRAW_BACK:
  190. (*****************************************************)
  191.    push ds
  192.    push si
  193.    push dx                   { Save DX also, may need it...}
  194.    push ax                   { Save shape number that was in }
  195.                              { al, need it to find out if should }
  196.                              { draw transparent foreground...}
  197.  
  198.    lds si, [bmap]            { Set pointer to background map }
  199.    add si, [back_si_save]
  200.  
  201.    xor ax, ax
  202.    mov al, ds:[si]           { Get shape # in al }
  203. {.................................................}
  204.                          { Now Check to see if Shape animating and if so }
  205.                          { draw the proper animation shape...}
  206.  
  207.      lds si, [BANM]      { Set pointer to Foreground anim data }
  208.      mov bx, ax          { Get shape number in bx }
  209.      shl bx, 4           { Multiply bx by 16 to get proper row of data }
  210.                          {   in Anim array...}
  211.      add si, bx
  212.  
  213.      xor bx, bx
  214.      mov bl, ds:[si]     { Get byte of data from anim array }
  215.      cmp bl, 255         { If CURRENT INDEX equals 255, then draw shape
  216.                          { as normally would...}
  217.      je @@END_ANIM_CHECK1
  218.  
  219.      add si, 3           { Move to first byte of anim pictures }
  220.      add si, bx          { Add CURRENT INDEX... }
  221.  
  222.      mov al, ds:[si]     { Get proper shape number to draw...}
  223.  
  224. @@END_ANIM_CHECK1:
  225. {.................................................}
  226.    shl ax, 10
  227.  
  228.    lds si, [bshp_ptr]        { Set si to Shape buffer }
  229.    add si, ax                { Add offset of shape }
  230.  
  231.    add si, [y_skip_offs]     { Offset based on Background Offset }
  232.    add si, [bo_x]            { Add x_to_skip to si }
  233.  
  234.    mov bx, [y_to_draw]       { Number rows in bx }
  235.  
  236. @@DRAW_1:
  237.    mov cx, [x_to_draw]       { Number of pixels x, in cx }
  238.  
  239.    rep movsb                 { Draw pixels !!! }
  240.  
  241.    add si, [bo_x]
  242.    add di, 320
  243.    sub di, [x_to_draw]       { Skip down to next row }
  244.  
  245.    dec bx
  246.    jnz @@DRAW_1              { loop!!!}
  247.  
  248.  
  249. @@CHECK_2:
  250.                     { IF we skipped part of top-left square, draw }
  251.                     { top part of square below it }
  252.    cmp [bo_y], 0
  253.    jz @@CHECK_3
  254.  
  255.    lds si, [bmap]
  256.    add si, [back_si_save]
  257.    add si, 128                { Down one row }
  258.  
  259.    xor ax, ax
  260.    mov al, ds:[si]
  261. {.................................................}
  262.                          { Now Check to see if Shape animating and if so }
  263.                          { draw the proper animation shape...}
  264.  
  265.      lds si, [BANM]      { Set pointer to Foreground anim data }
  266.      mov bx, ax          { Get shape number in bx }
  267.      shl bx, 4           { Multiply bx by 16 to get proper row of data }
  268.                          {   in Anim array...}
  269.      add si, bx
  270.  
  271.      xor bx, bx
  272.      mov bl, ds:[si]     { Get byte of data from anim array }
  273.      cmp bl, 255         { If CURRENT INDEX equals 255, then draw shape
  274.                          { as normally would...}
  275.      je @@END_ANIM_CHECK2
  276.  
  277.      add si, 3           { Move to first byte of anim pictures }
  278.      add si, bx          { Add CURRENT INDEX... }
  279.  
  280.      mov al, ds:[si]     { Get proper shape number to draw...}
  281.  
  282. @@END_ANIM_CHECK2:
  283. {.................................................}
  284.    shl ax, 10
  285.  
  286.    lds si, [bshp_ptr]        { Set si to Shape buffer }
  287.    add si, ax                { Add offset of shape }
  288.  
  289.    add si, [bo_x]            { Add x_to_skip to si }
  290.  
  291.    mov bx, [bo_y]       { Number rows in bx }
  292.  
  293. @@DRAW_2:
  294.    mov cx, [x_to_draw]       { Number of pixels x, in cx }
  295.  
  296.    rep movsb                 { Draw pixels !!! }
  297.  
  298.    add si, [bo_x]
  299.    add di, 320
  300.    sub di, [x_to_draw]       { Skip down to next row }
  301.  
  302.    dec bx
  303.    jnz @@DRAW_2
  304.  
  305.  
  306. @@CHECK_3:
  307.    cmp [bo_x], 0
  308.    jz @@DONE_CHECK
  309.  
  310.    mov di, [di_save]
  311.    add di, 32
  312.    sub di, [bo_x]
  313.  
  314.    lds si, [bmap]
  315.    add si, [back_si_save]
  316.    inc si                   { Over one column }
  317.  
  318.    xor ax, ax
  319.    mov al, ds:[si]
  320. {.................................................}
  321.                          { Now Check to see if Shape animating and if so }
  322.                          { draw the proper animation shape...}
  323.  
  324.      lds si, [BANM]      { Set pointer to Foreground anim data }
  325.      mov bx, ax          { Get shape number in bx }
  326.      shl bx, 4           { Multiply bx by 16 to get proper row of data }
  327.                          {   in Anim array...}
  328.      add si, bx
  329.  
  330.      xor bx, bx
  331.      mov bl, ds:[si]     { Get byte of data from anim array }
  332.      cmp bl, 255         { If CURRENT INDEX equals 255, then draw shape
  333.                          { as normally would...}
  334.      je @@END_ANIM_CHECK3
  335.  
  336.      add si, 3           { Move to first byte of anim pictures }
  337.      add si, bx          { Add CURRENT INDEX... }
  338.  
  339.      mov al, ds:[si]     { Get proper shape number to draw...}
  340.  
  341. @@END_ANIM_CHECK3:
  342. {.................................................}
  343.    shl ax, 10
  344.  
  345.    lds si, [bshp_ptr]         { Set si to Shape buffer }
  346.    add si, ax                { Add offset of shape }
  347.  
  348.    add si, [y_skip_offs]     { Offset based on Background Offset }
  349.  
  350.    mov bx, [y_to_draw]       { Number rows in bx }
  351.  
  352. @@DRAW_3:
  353.    mov cx, [bo_x]            { Number of pixels x, in cx }
  354.  
  355.    rep movsb                 { Draw pixels !!! }
  356.  
  357.    add si, [x_to_draw]
  358.    add di, 320
  359.    sub di, [bo_x]       { Skip down to next row }
  360.  
  361.    dec bx
  362.    jnz @@DRAW_3
  363.  
  364.  
  365. @@CHECK_4:
  366.                     { IF we skipped part of top-right square, draw }
  367.                     { top part of square below it }
  368.    cmp [bo_y], 0
  369.    je @@DONE_CHECK
  370.  
  371.    lds si, [bmap]
  372.    add si, [back_si_save]
  373.    add si, 129               { Down one row, over one column }
  374.  
  375.    xor ax, ax
  376.    mov al, ds:[si]
  377. {.................................................}
  378.                          { Now Check to see if Shape animating and if so }
  379.                          { draw the proper animation shape...}
  380.  
  381.      lds si, [BANM]      { Set pointer to Foreground anim data }
  382.      mov bx, ax          { Get shape number in bx }
  383.      shl bx, 4           { Multiply bx by 16 to get proper row of data }
  384.                          {   in Anim array...}
  385.      add si, bx
  386.  
  387.      xor bx, bx
  388.      mov bl, ds:[si]     { Get byte of data from anim array }
  389.      cmp bl, 255         { If CURRENT INDEX equals 255, then draw shape
  390.                          { as normally would...}
  391.      je @@END_ANIM_CHECK4
  392.  
  393.      add si, 3           { Move to first byte of anim pictures }
  394.      add si, bx          { Add CURRENT INDEX... }
  395.  
  396.      mov al, ds:[si]     { Get proper shape number to draw...}
  397.  
  398. @@END_ANIM_CHECK4:
  399. {.................................................}
  400.    shl ax, 10
  401.  
  402.    lds si, [bshp_ptr]        { Set si to Shape buffer }
  403.    add si, ax                { Add offset of shape }
  404.  
  405.    mov bx, [bo_y]       { Number rows in bx }
  406. @@DRAW_4:
  407.    mov cx, [bo_x]       { Number of pixels x, in cx }
  408.  
  409.    rep movsb                 { Draw pixels !!! }
  410.  
  411.    add si, [x_to_draw]
  412.    add di, 320
  413.    sub di, [bo_x]       { Skip down to next row }
  414.  
  415.    dec bx
  416.    jnz @@DRAW_4
  417.  
  418.  
  419. @@DONE_CHECK:
  420.    pop ax               { Restore Original foreground shape number...}
  421.    pop dx
  422.  
  423. (*****************************************************)
  424.  
  425.    cmp al, 30              { If shape # >= 32 < 48, draw compressed }
  426.    jb @@END_DRAW           { foreground shape..}
  427.  
  428.    cmp al, 48              { If it >= 48 then save it in a data structure}
  429.    jb @@DRAW_TRANS         { to draw later, after all objects/people drawn.}
  430.  
  431. (*****************************************************)
  432. @@SAVE_DATA:
  433.                         { Save DI, Pic # in data structure to draw later }
  434.    push es
  435.    push bx
  436.  
  437.    les di, [CT]
  438.    add di, [ct_di_save]
  439.  
  440.    mov es:[di], al            { Save shape number }
  441.    inc di
  442.    mov bx, [di_save]          { Save DI offset in ES to draw to }
  443.    mov es:[di], bx
  444.    inc di
  445.    inc di
  446.  
  447.    add [ct_di_save], 3       { Save offset in data structure }
  448.  
  449.    pop bx
  450.    pop es
  451.    jmp @@END_DRAW
  452.  
  453. (*****************************************************)
  454. @@DRAW_TRANS:
  455.    shl ax, 10               { Mul by 1024 to get Offset in Shape buffer.}
  456.  
  457.    mov di, [di_save]
  458.    lds si, [shp_ptr]
  459.    add si, ax               { ax holds offset }
  460.  
  461.    cld                      { Increment }
  462.    mov bx, 32d              { Do 32 rows...}
  463.  
  464. @@GET_INFO:
  465.    xor cx, cx
  466.    mov cl, [si]          { Read in byte from shape }
  467.    inc si
  468.  
  469.    cmp cl, 0                { If zero then jump to add space }
  470.    jz @@SKIP_PIXELS
  471.  
  472.    cmp cl, 255              { If 255, then want to go down to next row }
  473.    je @@NEXT_ROW
  474.                             { Otherwise we want to draw pixels }
  475.    rep movsb                { Draw them }
  476.    jmp @@GET_INFO
  477.  
  478. @@SKIP_PIXELS:
  479.    mov cl, [si]
  480.    add di, cx
  481.    inc si
  482.    jmp @@GET_INFO
  483.  
  484. @@NEXT_ROW:
  485.    add di, 288                   { re-align di to next row }
  486.  
  487.    dec bx                        { Count down one row, check if }
  488.    jnz @@GET_INFO                    { finished last row...         }
  489.  
  490. (*****************************************************)
  491.  
  492. @@END_DRAW:
  493.  
  494.      pop si
  495.      pop ds
  496.  
  497.      mov di, [di_save]      { Restore DI, increment by 32.. }
  498.      add di, 32             { Move over 32 pixels for next shape...}
  499.  
  500.      inc si                 { Go to next square in Map...}
  501.      inc [back_si_save]     { Go to next square in background }
  502.  
  503.      dec dl                 { Subtract 1 from x loop counter.}
  504.      jnz @@LOOP_X           { Loop back...}
  505.  
  506. @@FINISHED_X_LOOP:
  507.      add si, 118                { Move down one row in map }
  508.      add [back_si_save], 118    { Move down row in background }
  509.  
  510.      add di, 9920d         { move DI down to next row on screen.}
  511.  
  512.      dec dh                 { Decrement y loop counter...}
  513.      jnz @@LOOP_Y
  514.  
  515. @@FINISHED_Y_LOOP:
  516.      pop ds
  517. END;
  518.  
  519. END;
  520. {..........................................................}
  521. PROCEDURE Draw_Close_Terrain (VAR Shp_Ptr, CT); Assembler;
  522. ASM
  523.    push ds
  524.  
  525.    lds si, [CT]              { Set pointer to data structure }
  526.    les di, [screen]
  527.  
  528. @@LOOP:
  529.    xor ax, ax
  530.    mov al, ds:[si]           { Get Shape Number from Data Structure CT }
  531.    cmp al, 0                 { If zero then exit...done drawing }
  532.    je @@END
  533.  
  534. @@DRAW_SHAPE:
  535.    inc si
  536.    mov bx, ds:[si]           { Get Offset to draw shape at }
  537.    inc si
  538.    inc si
  539.  
  540.    mov di, bx                { Mov it into DI }
  541.  
  542.    push ds
  543.    push si
  544.    push bx
  545.  
  546.    cmp al, 54                { If is a transparent fore shape...}
  547.    jae @@DRAW_TRANS
  548.  
  549.    { Draw Regular shape, no compression }
  550. (**************************************************)
  551.    shl ax, 10
  552.    lds si, [shp_ptr]
  553.    add si, ax                 { ax holds offset in shape buffer }
  554.  
  555.    cld                           { Increment }
  556.    mov bx, 32d
  557.  
  558. @@DRAW:
  559.    mov cx, 16
  560.    rep movsw
  561.  
  562.    add di, 288                   { re-align di to next row }
  563.  
  564.    dec bx                        { Count down one row, check if }
  565.    jnz @@DRAW                    { finished last row...         }
  566.  
  567.    pop bx
  568.    pop si
  569.    pop ds
  570.    jmp @@LOOP
  571. (**************************************************)
  572.  
  573.    { Draw Shape with compression }
  574. (*****************************************************)
  575. @@DRAW_TRANS:
  576.    shl ax, 10               { Mul by 1024 to get Offset in Shape buffer.}
  577.    lds si, [shp_ptr]
  578.    add si, ax               { ax holds offset }
  579.  
  580.    cld                      { Increment }
  581.    mov bx, 32d              { Do 32 rows...}
  582.  
  583. @@GET_INFO:
  584.    xor cx, cx
  585.    mov cl, [si]          { Read in byte from shape }
  586.    inc si
  587.  
  588.    cmp cl, 0                { If zero then jump to add space }
  589.    jz @@SKIP_PIXELS
  590.  
  591.    cmp cl, 255              { If 255, then want to go down to next row }
  592.    je @@NEXT_ROW
  593.                             { Otherwise we want to draw pixels }
  594.    rep movsb                { Draw them }
  595.    jmp @@GET_INFO
  596.  
  597. @@SKIP_PIXELS:
  598.    mov cl, [si]
  599.    add di, cx
  600.    inc si
  601.    jmp @@GET_INFO
  602.  
  603. @@NEXT_ROW:
  604.    add di, 288                   { re-align di to next row }
  605.  
  606.    dec bx                        { Count down one row, check if }
  607.    jnz @@GET_INFO                    { finished last row...         }
  608.  
  609.    pop bx
  610.    pop si
  611.    pop ds
  612.    jmp @@LOOP
  613. (*****************************************************)
  614.  
  615.  
  616. @@END:
  617.    { Clear Data Structure }
  618.    les di, [CT]
  619.  
  620.    mov ax, 0
  621.    mov cx, 100
  622.    rep stosw
  623.  
  624.    pop ds
  625. END;
  626. {............................................................................}
  627. PROCEDURE Process_Anim_Array (VAR Anm_Array); Assembler;
  628. ASM
  629.      push ds
  630.  
  631.      lds si, [Anm_Array]
  632.  
  633.      xor dx, dx              { Use dx as counter..to do all 64 shapes }
  634.  
  635. @@LOOP:
  636.      xor ax, ax
  637.      mov al, ds:[si]         { Check to see if first shape number }
  638.                              {  is 255, if so then shape DOES NOT }
  639.                              {  animate, so skip to next shape... }
  640.      cmp al, 255
  641.      je @@NEXT_SHAPE
  642.  
  643.      mov al, ds:[si+2]       { Now find out if current_wait_time EQUALS zero }
  644.      cmp al, 0               { If so, then increment index, check }
  645.      jne @@DEC_WAIT_TIME
  646.  
  647.      xor bx, bx
  648.      mov bl, ds:[si]         { Get current index, increment it ...}
  649.      inc bl
  650.      mov ds:[si], bl         { Moveback into current index }
  651.      add si, bx
  652.                              { If the shape number at this new index }
  653.                              { is 255 then set index to ZERO, set }
  654.                              { current_wait_time to total_wait_time. }
  655.      mov al, ds:[si+3]
  656.      sub si, bx
  657.      cmp al, 255
  658.      jne @@SET_TIME
  659.  
  660.      mov al, 0               { Set current index to zero }
  661.      mov ds:[si], al
  662.  
  663. @@SET_TIME:
  664.      mov al, ds:[si+1]       { Set Current_wait_time }
  665.      mov ds:[si+2], al
  666.  
  667.      jmp @@NEXT_SHAPE
  668.  
  669. @@DEC_WAIT_TIME:
  670.      dec al
  671.      mov ds:[si+2], al
  672.  
  673. @@NEXT_SHAPE:
  674.      inc dx
  675.      cmp dx, 64
  676.      je @@END
  677.  
  678.      add si, 16
  679.      jmp @@LOOP
  680.  
  681. @@END:
  682.      pop ds
  683.  
  684. END;
  685. {..........................................................}
  686. PROCEDURE Copy_Part_Screen_Diff (x, y, sx, sy, x_size, y_size : word);
  687.                                  Assembler;
  688. {
  689.   X and Y hold the location in Display that image is to go to,
  690.   and SX, SY hold location in Screen from which to draw..
  691. }
  692.  
  693. ASM
  694.    push ds
  695.  
  696.    mov dx, 03dah
  697. @@WAIT_VS1:
  698.    in al, dx
  699.    test al, 08h          { Check vertical sync before continue.. }
  700.    jz @@WAIT_VS1
  701.  
  702.    xor di,di
  703.    mov ax,Video_mem
  704.    mov es,ax
  705.  
  706.    lds si, [Screen]
  707.  
  708.    mov ax, [y]                   { Get row in y }
  709.    mov bx, [y]
  710.    shl ax, 8                     { Shifts fast!!!}
  711.    shl bx, 6
  712.    add ax, bx
  713.    mov [y], ax
  714.  
  715.    mov ax, [sy]                   { Get row from sy }
  716.    mov bx, [sy]
  717.    shl ax, 8                      { Shifts fast!!!}
  718.    shl bx, 6
  719.    add ax, bx
  720.    mov [sy], ax
  721.  
  722.    add di, [y]                   { Set di to proper offset row and }
  723.    add si, [sy]                   { Set si to proper...             }
  724.  
  725.    add di, [x]                   { proper off in that row...       }
  726.    add si, [sx]
  727.  
  728.    cld
  729.  
  730.    mov dx, [x_size]           { dx holds # of bytes in x..}
  731.    shr dx, 1d                 { get # of WORDS to process }
  732.    mov bx, [y_size]           { bx is counter for rows...}
  733.  
  734. @@DRAW:
  735.    mov cx, dx
  736.    rep movsw
  737.  
  738. @@NEXT:
  739.    add si,320d
  740.    add di,320d
  741.    sub si,[x_size]
  742.    sub di,[x_size]
  743.  
  744. @@loop:
  745.    dec bx
  746.    jnz @@DRAW
  747.  
  748. @@DONE:
  749.  
  750. pop ds
  751. END;
  752. {.....................................................................}
  753. PROCEDURE Draw_People;
  754.  
  755. VAR
  756.  x,t       : Integer;
  757.  Objectnum : Integer;
  758.  dx, dy    : integer;
  759.  
  760. BEGIN
  761.  For Objectnum := 0 to Num_Of_Objects-1 DO
  762.   BEGIN
  763.    dy := py - (Screen_y shl 5);
  764.    IF (dy >= 0) AND (dy < 160) THEN
  765.     BEGIN
  766.        dx := px - (Screen_x shl 5);
  767.        IF (dx >= 0) AND (dx < 288) THEN
  768.           Draw_Image_Screen_Tran (dx,dy,32,32,Player_Ptr^);
  769.     END;
  770.   END;
  771. END;
  772.  
  773.  
  774. **** The routine Draw_Image_Screen_Tran is just a transparent
  775.      image drawing routine, that takes coords in vscreen,
  776.      size, and a pointer to image data...
  777.  
  778. {.....................................................................}
  779.